clear

global folder "~/Dropbox/Papers\23CBFunctionsHistory"

cd "$folder"

use "$folder\ConstrainOrInform\01Data\CBFunctionsRevised.dta"

xtset id year



*H1
*Gov Credit not associated with Business support
cloglog CBGovtCreditSurvival Business t t2 t3, vce(cl id)
estimates store GovcloglogLib1

cloglog CBGovtCreditSurvival Business InterNatWar LegislativeConst FiscalCapacity lnGDPPerCap SovDefault Inflation t t2 t3, vce(cl id)
estimates store GovcloglogLib2


*cloglog CBGovtCreditSurvival Aristocratic t t2 t3, vce(cl id)
*estimates store GovcloglogAris1

*cloglog CBGovtCreditSurvival Aristocratic InterNatWar LegislativeConst FiscalCapacity GDPPerCapita SovDefault Inflation t t2 t3, vce(cl id)
*estimates store GovcloglogAris2


cloglog CBGovtCreditSurvival Military t t2 t3, vce(cl id)
estimates store GovcloglogMil1

cloglog CBGovtCreditSurvival Military InterNatWar LegislativeConst FiscalCapacity lnGDPPerCap SovDefault Inflation t t2 t3, vce(cl id)
estimates store GovcloglogMil2

cloglog CBGovtCreditSurvival Military InterNatWar LegislativeConst FiscalCapacity lnGDPPerCap SovDefault Inflation t t2 t3 if Independent == 1, vce(cl id)
estimates store GovcloglogMil3

cloglog CBGovtCreditSurvival Military InterNatWar LegislativeConst FiscalCapacity lnGDPPerCap SovDefault Inflation t t2 t3 if Euro == 1, vce(cl id)
estimates store GovcloglogMil4



*Private Credit is associated with Business support
cloglog CBDiscountSurvival Business t t2 t3, vce(cl id)
estimates store PrivcloglogLib1

cloglog CBDiscountSurvival Business InterNatWar ElectoralDemoc UrbanRate FiscalCapacity lnGDPPerCap Inflation t t2 t3, vce(cl id)
estimates store PrivcloglogLib2

cloglog CBDiscountSurvival Business InterNatWar ElectoralDemoc UrbanRate FiscalCapacity lnGDPPerCap Inflation t t2 t3 if Independent == 1, vce(cl id)
estimates store PrivcloglogLib3

cloglog CBDiscountSurvival Business InterNatWar ElectoralDemoc UrbanRate FiscalCapacity lnGDPPerCap Inflation t t2 t3 if Euro == 1, vce(cl id)
estimates store PrivcloglogLib4


*cloglog CBDiscountSurvival Aristocratic t t2 t3, vce(cl id)
*estimates store PrivcloglogAris1

*cloglog CBDiscountSurvival Aristocratic InterNatWar ElectoralDemoc UrbanRate FiscalCapacity GDPPerCapita Inflation t t2 t3, vce(cl id)
*estimates store PrivcloglogAris2


cloglog CBDiscountSurvival Military t t2 t3, vce(cl id)
estimates store PrivcloglogMil1

cloglog CBDiscountSurvival Military InterNatWar ElectoralDemoc UrbanRate FiscalCapacity lnGDPPerCap Inflation t t2 t3, vce(cl id)
estimates store PrivcloglogMil2








*Hazard functions
cloglog CBDiscountSurvival Business t t2 t3, vce(cl id)
predict h0 if Business ==0, p
predict h1 if Business ==1, p
sort year
by year: egen LibHaz0 = mean(h0)
by year: egen LibHaz1 = mean(h1)

sort iso year
cloglog CBDiscountSurvival Military t t2 t3, vce(cl id) eform
predict m0 if Military ==0, p
predict m1 if Military ==1, p
sort year
by year: egen MilHaz0 = mean(m0)
by year: egen MilHaz1 = mean(m1)

sort iso year
cloglog CBGovtCreditSurvival Business t t2 t3, vce(cl id) eform
predict h00 if Business ==0, p
predict h11 if Business ==1, p
sort year
by year: egen LibHaz00 = mean(h00)
by year: egen LibHaz11 = mean(h11)

sort iso year
cloglog CBGovtCreditSurvival Military t t2 t3, vce(cl id) eform
predict m00 if Military ==0, p
predict m11 if Military ==1, p
sort year
by year: egen MilHaz00 = mean(m00)
by year: egen MilHaz11 = mean(m11)


*reg CBDiscount Business, vce(cl id)
*reg CBGovtCredit  Military, vce(cl id)
*reg CBGovtCredit Military  InterNatWar ElectoralDemoc UrbanRate FiscalCapacity GDPPerCapita Inflation, vce(cl id)
*reg CBDiscount Business InterNatWar ElectoralDemoc UrbanRate FiscalCapacity GDPPerCapita Inflation, vce(cl id)


*twoway (connected LibHaz0 year if year>=1789, ysc(range(0 0.1))) (connected LibHaz1 year if year>=1789, ysc(range(0 0.1)))




*LLR intervention
*cloglog llr Business InterNatWar ElectoralDemoc UrbanRate FiscalCapacity lnGDPPerCap  Inflation GoldStandard GovtDebtGDP  t t2 t3, vce(cl id)
*reg llr Business InterNatWar ElectoralDemoc UrbanRate FiscalCapacity lnGDPPerCap  Inflation GoldStandard GovtDebtGDP  t t2 t3, vce(cl id)



*These show that LLR was more likely if a CB was already discounting bills of exchange
*cloglog lending CBDiscount##crisiscandidate Business t t2 t3, vce(cl id)
*estimates store DiscLendingCloglog1


*cloglog lending CBDiscount##crisiscandidate Business ElectoralDemoc lnGDPPerCap GoldStandard t t2 t3 , vce(cl id)
*estimates store DiscLendingCloglog2

*cloglog lending CBGovtCredit##crisiscandidate Business t t2 t3, vce(cl id)
*estimates store GovtLendingCloglog1

*cloglog lending CBGovtCredit##crisiscandidate Business ElectoralDemoc lnGDPPerCap GoldStandard t t2 t3 , vce(cl id)
*estimates store GovtLendingCloglog2


*tab CBDiscount CBGovtCredit, sum(lending)





*Results then are as follows:
*1) Business ties explain private sector discounting. Business ties are not associated with government lending.
*2) Likelihood of LLR lending is higher with Business and having a CB that discounts. LLR not associated with government lending.
***Overall message #1: Modern central bank design has roots in changing politics that saw rise of Business support for governments.
***Overall message #2: Decades later, even controlling for Business ties, prior experience with discounting meant that precursor central banks were more likely to engage in LLR lending.
**Note that, in a way, the CBDiscount impacting lending is not surprising. What is more surprising is that GovtCredit did NOT impact lending.


*See also local projections LLR. With no control variables, a discount shock makes LLR intervention over the next 7ish years more likely.
*Then regular regressions just above show that Business is associated with LLR as well.

*Local projections are probably stronger. Put regular regressions in the appendix.



****alternatively.....
*************If I split the private/govt lending results from the LLR results, then the LLR results can be used as follows

*by id: gen Sumlending = sum(lending)
*cloglog CBLLRSurvival l.Sumlending CBDiscount##crisiscandidate Business t t2 t3, vce(cl id)
*cloglog CBLLRSurvival l.Sumlending t t2 t3, vce(cl id)


*cloglog CBLLRSurvival Sumlending CBDiscount lnGDPPerCap ElectoralDemoc Inflation t t2 t3, vce(cl id)

*cloglog CBLLRSurvival Sumlending CBDiscount lnGDPPerCap ElectoralDemoc Inflation UrbanRate Business t t2 t3, vce(cl id)




*These are a decent start....but CBGovCredit also shows significant results....
*cloglog CBLLRSurvival Sumlending CBDiscount t t2 t3, vce(cl id)

*cloglog CBLLRSurvival Sumlending CBDiscount lnGDPPerCap ElectoralDemoc DomesticConflict UrbanRate crisiscandidate  Business Conservative Military t t2 t3, vce(cl id)






*Results then are as follows:
*1) Likelihood of actual LLR lending is higher with Business and having a CB that discounts. LLR not associated with government lending.
*2) Laws enshrining LLR powers followed LLR activities in practice. This is an example of law catching up with established practice.
***Overall message #1: Precursor central banks with prior discounting experience were more likely to engage in LLR lending.
***Overall message #2: Prior LLR lending led governments to codify LLR powers in law.

*****But if we swap CBLLR fof CBDiscount, we also find that LLR capabilities also increased the likelihood of LLR lending....this is nor surprising, but it takes away from my discounting argument....



**Note that, in a way, the CBDiscount impacting lending is not surprising. What is more surprising is that GovtCredit did NOT impact lending.







